/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ru.staf.NetworkReportGenerator.V2;

import java.util.Set;
import java.util.regex.Pattern;
import java.util.Date;

import org.jrobin.core.RrdException;

/**
 *
 * @author aezhov
 */
public class AutoSwitch extends Switch {
    static int counter = 0;
    int portCounter = 0;

    public AutoSwitch(Switch sw, Date fromDate, Date toDate) throws RrdException {
        super("auto-" + (++counter), fromDate, toDate);
        portPattern = Pattern.compile("port(\\d+)");
        connections.put("port0", sw);
    }

    public void addAllMacs(Set<String> macs) {
        for (String mac : macs) {
            LeafDevice node = LeafDevice.getConcreteDevice(mac);
            connections.put("port" + (++portCounter), node);
        }
    }

    public int getPortSpeed(String name) {
        return 100000000;
    }

    public boolean isPortUp(String name) {
        return true;
    }
}
